// 监听页面长时间未操作状态
const actionListener = () => {
  var count = 0;
  var outTime = 0.1; //分钟
  var Tim;
  function go() {
    count++;
    if (count == outTime * 60) {
      // 此处处理后续操作
      // alert('您长时间未操作页面');
      console.log("您长时间未操作页面--------", count);
      window.vueVm.$showTimOutView.show();
      return window.clearInterval(Tim);
    }
  }
  //页面倒计时
  Tim = window.setInterval(go, 1000);
  //监听鼠标
  var x;
  var y;

  document.onmousemove = function (event) {
    var x1 = event.clientX;
    var y1 = event.clientY;
    if (x != x1 || y != y1) {
      count = 0;
    }
    x = x1;
    y = y1;
  };

  document.onmousedown = function (event) {
    count = 0;
  };

  document.onkeydown = function (event) {
    count = 0;
  };
};

export { actionListener };
